<?php
// +----------------------------------------------------------------------
// | Copyright © Sogu Technologies Co. Ltd 2018-2050 All rights reserved.
// +----------------------------------------------------------------------
// | File name: backend.php
// +----------------------------------------------------------------------
// | Author: gxs
// +----------------------------------------------------------------------
// | Description: 后台路由文件
// +----------------------------------------------------------------------
// | Others: 其他内容的说明
// +----------------------------------------------------------------------
// | History: 修改历史记录列表，每条修改记录应包含修改日期、修改者及修改内容简述
// +----------------------------------------------------------------------
// | 1.Date: 2018/12/27 Author: gxs Modification: 创建
// +----------------------------------------------------------------------

Route::group(['middleware' => 'backend_maintain'], function () {
    /*
     * 后台
     */
    Route::group(['namespace'=>'Backend','prefix'=>'b'], function() {
        /*
         * 登录
         */
        Route::group([],function () {
            Route::post('login', 'SiteController@login')->name('site.login');
            Route::get('logout', 'SiteController@logout')->name('site.logout');
        });
        /*
         * 管理员模块
         */
        Route::group(['namespace'=>'Admin'], function () {
            Route::get('test', 'AdminController@test')->name('admin.test');
            Route::get('check', 'AdminController@check')->name('admin.check');
            Route::apiResource('admin', 'AdminController')->parameter('admin', 'id');
            Route::put('admin/{id}', 'AdminController@update')->name('admin.update');
            Route::patch('admin/{id}', 'AdminController@reset')->name('admin.reset');
            Route::patch('admin/password/{id}', 'AdminController@password')->name('admin.password');
            Route::apiResource('role', 'RoleController')->parameter('role', 'id'); //角色
        });

        /*
         * 其他
         */

        /**
         * 公共配置
         */
        Route::group(['namespace'=>'Common'],function () {
            Route::post('uploadsFile','UploadFileController')->name('uploadFile.uploadsFile');
        });


        /*
         * 系统的相关配置信息
         */
        Route::group(['namespace'=>'Setting'],function () {
            //网站扒窗
            Route::apiResource('bannerImage', 'SettingBannerImageController');
            //轮播图
            Route::apiResource('homeImage', 'SettingHomeImageController');
            //弹窗开关设置
            Route::apiResource('settingSwitch', 'SettingPopupSwitchController');
            //保险业务 上下移动显示位置
            Route::get('changeSiteUpOrDown', 'SettingHomeInsuranceController@changeSiteUpOrDown');
            //首页保险H5配置
            Route::apiResource('homeInsurance', 'SettingHomeInsuranceController');
            //资方设置
            Route::apiResource('channel', 'SettingChannelController');
            //文档设置
            Route::apiResource('document', 'SettingDocumentController');
            Route::apiResource('rate', 'SettingRepayRateController');
            //获取提示语
            Route::get('hint','SettingHintController@getHint')->name('settingHint.getHint');
            //设置提示语
            Route::put('hint/{id}','SettingHintController@setHint')->name('settingHint.setHint');
            //获取loans的信息
            Route::get('loans','SettingLoanController@getLoans')->name('settingLoan.loans');
            Route::put('loans/{id}','SettingLoanController@setLoans')->name('settingLoan.loans');

            /**
             * 用户来源渠道
             */
            Route::apiResource('source','SourceController');

        });

        /**
         * 还款信息
         */
        Route::group(['namespace'=>'Repay'],function () {
            Route::get('repay','RepayController@getRepayInfo')->name('repay.backend_repay');
            Route::get('repay/export','RepayController@repayExport')->name('repay.backend_repay_export');
            Route::get('status','RepayController@getStatus')->name('repay.status');
            Route::get('userlist','RepayController@getUserInfo')->name('repay.userlist');
            Route::get('o','RepayCountController@overdueExcel')->name('repay.overdue_excel');
            Route::get('r','RepayCountController@repayExcel')->name('repay.repay_excel');
        });

        /**
         * 银行
         */
        Route::group(['namespace'=>'Bank'],function () {
            //银行图标首页
            Route::get('bank','BankController@index')->name('bank.index');
            //新增银行卡图标
            Route::post('bank','BankController@store')->name('bank.store');
            //银行列表
            Route::get('bank/bank_list','BankController@bankList')->name('bank.list');
            //银行图标详细信息
            Route::patch('bank/{bankId}','BankController@update')->name('bank.update');
            //删除银行卡图标信息
            Route::delete('bank/{bankId}','BankController@delete')->name('bank.delete');
            //银行图标详细信息
            Route::get('bank/{bankId}','BankController@detail')->name('bank.detail');

            //热门信用卡推荐
            Route::apiResource('credit_card','RecommendCreditCardCrontroller');
            //热门银行卡
            Route::apiResource('hot','HotCreditCardController');
            //办卡进度查询
            Route::apiResource('progress','ProgressBankController');
        });

        /*
         * 用户模块
         * */
        Route::group(['namespace'=>'User'],function () {
            //用户列表
            Route::get('user', 'UserController@index')->name('user.index');
            Route::get('user/export', 'UserController@export')->name('user.export');
            //用户状态列表
            Route::get('user/status', 'UserController@statusList')->name('user.status.index');
            //用户借款情况
            Route::get('user/trans/{userId}', 'UserController@transLog')->name('user.trans.index');
            Route::get('user/new', 'UserController@newUser')->name('user.new.index');
            Route::get('user/new/export', 'UserController@newExport')->name('user.new.export');
            Route::get('user/new/{userId}', 'UserController@transLog')->name('user.trans.index');
            //用户详情
            Route::get('user/{userId}', 'UserController@show')->name('user.show');

            Route::get('loan/detail','LoanRequestController@history');
            Route::get('loan/current','LoanRequestController@current');

            Route::get('user-filter','UserController@userlistFilter')->name('user.user-filter');

        });

        /*
         * 更新窗口提示
         * */
        Route::group(['namespace'=>'AppUpdate'], function(){
            //更新日志
            Route::get('app_update','AppUpdateController@index')->name('app_update.index');
            //添加更新日志
            Route::post('app_update','AppUpdateController@store')->name('app_update.store');
        });

        /**
         * 放款
         */
        Route::group(['namespace' => 'Financial'],function (){
            //按日期获取放款结果数据列表
            Route::get('loanResultList','LoanResultController@getResultList')->name('financial.loan_result_list');
            //按照指定日期获取当天放款数据
            Route::get('loanResultByDate','LoanResultController@getRecordByDate')->name('financial.loan_result_by_date');
            //获取用户放款异常列表
            Route::get('loanChangeCardList','LoanResultController@loanChangeCardList')->name('financial.loan_change_card_list');
            //处理放款异常
            Route::patch('handleLoan/{loan_id}','LoanResultController@handleLoan')->name('financial.handle_loan');
            //放款异常允许处理状态列表
            Route::get('getLoanStatusList','LoanResultController@getLoanStatusList')->name('financial.get_loan_status_list');

            Route::get('loanExport','LoanResultController@export')->name('financial.loan_exception_export');
        });

        /**
         * 后台系统消息
         */
        Route::group(['namespace'=>'Message'],function (){
            Route::apiResource('messageTemplate','MessageTemplateController');
            Route::post('messageSend','MessageSendController@send')->name('message.message_send');

            /**
             * 页面消息
             */
            Route::put('headerMessage/enable/{headerMessage}','HeaderMessageController@enable')->name('message.header_message');
            Route::apiResource('headerMessage','HeaderMessageController');
            //快讯信息
            Route::apiResource('newsMessage','NewsMessageController');
        });

        Route::group(['namespace' => 'FollowData'],function(){
            route::get('exportParams','UserFollowDataController@exportRequestParams');
            route::get('exportAvgTime','UserFollowDataController@maiDianTimeGapCalExcel');
            route::get('getTypeList','UserFollowDataController@getTypeList');

            route::get('getChannelLoanBeforeData','ChannelLoanBeforeDataController@requestParams');


        });

        Route::group(['namespace' => 'OutWeb','prefix' => 'out_web'],function(){
            Route::get('query','QueryController@phone');
        });
    });
});